import React from 'react'
import {useDispatch , useSelector} from 'react-redux'
import { getMovieAction } from '../../store/slice/movieSlice'
export default function Movie() {
    const dispatch = useDispatch()
    const  count  = useSelector(state=>state.count.count)
    const  movieList  = useSelector(state=>state.movie.movieList)
    const getMovieList = () => {
        dispatch(getMovieAction())
    }
    return (
        <div>
            <hr />
            <h2>这里要拿到Count的值{count}</h2>
            <p>电影的数量{movieList.length}</p>
            <button onClick={ getMovieList }>获取电影列表</button>
            <ul>
                {
                    movieList.map(item=>{
                        return <li key={item.tvId}>{item.albumName}</li>
                    })
                }
            </ul>
        </div>
    )
}
